package com.hundsun.monitor.client.gadgets;

import com.google.gwt.user.client.ui.Label;
import com.hundsun.monitor.client.model.Gadget;
import com.hundsun.monitor.client.model.GadgetClass;
import com.hundsun.monitor.client.model.UserPref;

public class HelloWorldGadget extends Gadget{
	
	public static class Class extends GadgetClass {
		public static UserPref text = new UserPref("Text","Hello 世界");
		public Class(){
			super("Hello 世界",true);
			addUserPref( text );
		}
		public Gadget newGadget(){
			return new HelloWorldGadget(this);
		}
	}
	
	private Label label = new Label();  
    protected HelloWorldGadget(Class c){
    	super(c);
    	initWidget( label );
    	setStyleName("HelloWorld");
    }
    
    public void refresh(){
    	label.setText( (String)getUserPrefValue(Class.text) );
    }
}